﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Croxweb.Leuphana.Models;

namespace Croxweb.Leuphana.ViewModels
{
    public class PersonViewModel : ViewModelBase
    {
        private readonly Person person;

        public PersonViewModel() { this.person = new Person();
        }
        public PersonViewModel(Person person)
        {
            this.person = person;
        }

        public int Id {get{return person.Id;}
            set
            {
                person.Id = value;
                NotifyPropertyChanged("Id");
            }
        }

        public String FirstName
        {
            get { return person.FirstName; }
            set
            {
                person.FirstName = value;
                NotifyPropertyChanged("FirstName");
            }
        }

        public String LastName
        {
            get{ return person.LastName; }
            set
            {
                person.LastName = value;
                NotifyPropertyChanged("LastName");
            }
        }

        public String FullName
        {
            get { return FirstName + " " + LastName; }
        }

        public String EmailAddress
        {
            get { return person.EmailAddress; }
            set
            {
                person.EmailAddress = value;
                NotifyPropertyChanged("EmailAddress");
            }
        }

        public void Refresh()
        {
            NotifyPropertyChanged(string.Empty);
        }
    }
}
